<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>交易记录</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css">
</head>
<body class="bg-light">
<div class="container mt-5">
    <div class="card shadow">
        <div class="card-body">
            <div class="d-flex justify-content-between align-items-center mb-4">
                <h2 class="card-title">交易记录</h2>
                <a href="{{ url_for('customer_dashboard') }}" class="btn btn-outline-primary">返回仪表盘</a>
            </div>

            <form method="GET" class="row g-3 mb-4">
                <div class="col-md-5">
                    <label for="start_date" class="form-label">开始日期</label>
                    <input type="date" class="form-control" id="start_date" name="start_date" value="{{ start_date }}">
                </div>
                <div class="col-md-5">
                    <label for="end_date" class="form-label">结束日期</label>
                    <input type="date" class="form-control" id="end_date" name="end_date" value="{{ end_date }}">
                </div>
                <div class="col-md-2">
                    <label class="form-label">&nbsp;</label>
                    <button type="submit" class="btn btn-primary w-100">查询</button>
                </div>
            </form>

            <div class="table-responsive">
                <table class="table table-striped">
                    <thead>
                        <tr>
                            <th>交易日期</th>
                            <th>交易类型</th>
                            <th>交易金额</th>
                            <th>备注</th>
                        </tr>
                    </thead>
                    <tbody>
                        {% for trade in trades %}
                        <tr>
                            <td>{{ trade.tradeDate.strftime('%Y-%m-%d %H:%M:%S') if trade.tradeDate else '' }}</td>
                            <td>{{ trade.tradeType }}</td>
                            <td>¥ {{ "%.2f"|format(trade.tradeMoney) }}</td>
                            <td>{{ trade.remark }}</td>
                        </tr>
                        {% endfor %}
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>
</body>
</html> 